// import echarts from "echarts";
import { lineOption } from "./options";
import Base from "./base";
import "echarts/src/chart/line"; //折线
import { deepClone } from "./utils";

function barInitData(datas) {
    if (!(datas instanceof Array)) throw new Error("initData 请传入 数组");
    datas.forEach(data => {
        data.type = "line";
        // data.color = 'red';
        // data.barWidth = '60%';
    });
}

export default class Line extends Base {
    constructor(dom, initData = [], xAxisData = [], newOption = {}) {
        let newInitData = deepClone(initData);
        barInitData(newInitData);
        super(dom, newInitData, xAxisData, lineOption, newOption);
        this.lineLabel = {
            normal: {
                show: true
            }
        };
    }
}
